// module.exports = {
export const myMixins = {
    data(){
        return{
            isShowTop:false,
            list: [],
            queryObj:{
                pageNum:1,
                pageSize:10,
            },
            total:0,
            status: 'nomore',
            loadText: '上拉加载更多',
            scrollTop: 0,
        }
    },
    methods: {
        handleReset(){
            this.queryObj.pageNum = 1
            this.list = []
        },
        updateData(data){
            this.queryObj.pageNum = 1
            this.total = 0
            this.status = 'loadmore'
            this.list = []
            this.getList()
        },
    },
    // 下拉刷新的事件
    async onPullDownRefresh() {
        // 1. 重置关键数据
        this.handleReset()
        await this.getList()
    },
    /** 上拉加载 */
    async onReachBottom() {
        if (this.queryObj.pageNum*this.queryObj.pageSize<this.total){
            this.queryObj.pageNum++
            await this.getList()
            this.status = 'loadmore'
            uni.stopPullDownRefresh()
        }else{
            this.status = 'nomore'
        }
    },

}
